Readme file for the replication of "Social Exclusion and Ethnic Segregation in Schools: The Role of Teacher’s Ethnic Prejudice" by Sule Alan, Enes Duysak, Elif Kubilay and Ipek Mumcu
August 2021

The replication do-files allow replication of the results reported in the paper and online appendix. The replication can be done using Stata version 16.1 or higher. The codes can be run both on the Microsoft Windows and iOS operating systems.  

[A] Replication folder includes the data file and codes to reproduce the results presented in the paper. 
	(1) "biat_ethnic.dta" is the main data file, includes all the variables listed in part [B].
	(2) "1_master.do" is the master do file that calls the following 10 (ten) do-files that contain the codes. 
	(3) "2_variable construction.do" is the do-file that includes codes that construct measures of interest. 
	(4) "3.1_figure1.do" is the do-file that includes codes for figure 1.
	(5) "3.2_appendix_figure3.do" is the do-file that includes codes for appendix figure A2 and A3. 
	(6) "4.1_appendix_tables_supplemented sample.do" is the do-file that includes codes for appendix tables A1 and A6.
	(7) "4.2_descriptive analysis.do" is the do-file that includes codes for table 1-4 in the main paper.
	(8) "4.3_analysis_appendix table 2.do" is the do-file that includes codes for appendix table A2. 
	(9) "4.4_analysis_main tables.do" is the do-file that includes codes for table 5-7 in the main paper.
	(10) "4.5_appendix_figures.do" is the do-file that includes codes for appendix figure A4 and A5.
	(11) "4.6_figure 2.do" is the do-file that includes codes for figure 2.
	(12) "5_robustness.do" is the do-file that includes codes for appendix tables A3, A4 and A5. 


[B] Data:
	braven				Baseline Raven Score
	bsurvey01_book3			Bullying Q1-Class
	bsurvey02_book3			Bullying Q2-Class
	bsurvey03_book3			Bullying Q3-Class
	bsurvey04_book3			Bullying Q1-School
	bsurvey05_book3			Bullying Q2-School
	bsurvey06_book3			Bullying Q3-School
	btmarital			Marital Status of Teacher
	bttenured			Tenured Teacher
	bteducation			Education Level of Teacher
	btsurvey_22_2			Arranged by the teacher (2 = Arranged by me)
	btraven				Teacher's Raven Score
	data_baseline			Baseline data
	fphysicalbully			Followup Teacher's Report for Student Physical Bullying
	fverbalbully			Followup Teacher's Report for Student Verbal Bullying
	ftemper				Followup Teacher's Report for Student Temper
	b_student_absent			Baseline  absent student
	b_districtid			group(province district)
	b_schoolid			group(b_districtid school)
	b_classid			group(b_schoolid bclass btname)
	grade1				Baseline grade
	urfa				Student located in Sanliurfa
	male				Male student
	refugee				Refugee student
	ageinm				Age in months
	astudent				Baseline - Aferin student
	workingmother			Students whose mother is working
	workingfather			Students whose father is working
	computer				Access to computer at home
	internet				Access to internet at home
	math_correct			Total correct answers from baseline math test
	turk_correct			Total correct answers from baseline Turkish test
	bfriend_total_refugee		Baseline - Friend - Total out-degree refugee nodes
	bstudy_total_refugee		Baseline - Study - Total out-degree refugee nodes
	bsupport_total_refugee		Baseline - Support - Total out-degree refugee nodes
	bstudy_self_total_refugee		Baseline - Studyself - Total out-degree refugee nodes
	bsupport_self_total_refugee	Baseline - Supportself - Total out-degree refugee nodes
	biat_ethnic			Baseline ethnic IAT of teacher
	b_pedagogy			Baseline - Teacher Curiosity Pedagogy score
	b_gms				Baseline - Teacher GMS score
	b_idealism			Baseline - Teacher Idealism score
	b_competence			Baseline - Teacher Competence score
	b_modern				Baseline - Teacher Modern Teaching score
	b_extrinsic			Baseline - Teacher Extrinsic Motivation score
	b_warmth				Baseline - Teacher Warmth score
	baseline_tage			Baseline - Teacher's age
	baseline_tmale			Baseline - Male teacher
	baseline_tterm			Baseline - Number of terms teacher has been teaching
	baseline_tchildnum		Baseline - Number of teacher's children
	baseline_texperience		Baseline - Teacher's experience in terms of years
	fethnicbias			Followup -  Student ethnic bias
	beyes_correct			Baseline - Student's correct number of answers from Eyes test
	bteyes				Baseline - Teacher's correct number of answers from Eyes test
	bnode_in_friend			Node Level In Degree friend
	bnode_out_friend			Node Level Out Degree friend
	bcoleman_ref1_friend		Coleman's Homophily Index Ethnicity (Host Group) friend
	bcoleman_ref2_friend		Coleman's Homophily Index Ethnicity (Refugee Group) friend
	bnode_out_support		Node Level Out Degree support
	bcoleman_ref1_support		Coleman's Homophily Index Ethnicity (Host Group) support
	bcoleman_ref2_support		Coleman's Homophily Index Ethnicity (Refugee Group) support
	bnode_out_supportself		Node Level Out Degree supportself
	bcoleman_ref1_supportself		Coleman's Homophily Index Ethnicity (Host Group) supportself
	bcoleman_ref2_supportself		Coleman's Homophily Index Ethnicity (Refugee Group) supportself
	bnode_out_study			Node Level Out Degree study
	bcoleman_ref1_study		Coleman's Homophily Index Ethnicity (Host Group) study
	bcoleman_ref2_study		Coleman's Homophily Index Ethnicity (Refugee Group) study
	bnode_out_studyself		Node Level Out Degree studyself
	bcoleman_ref1_studyself		Coleman's Homophily Index Ethnicity (Host Group) studyself
	bcoleman_ref2_studyself		Coleman's Homophily Index Ethnicity (Refugee Group) studyself
	bnode_in_favorite		Node Level In Degree favorite
	support_provided			Total Node Emotional Support Provided
	study_provided			Total Node Study Provided
	support_received			Total Node Emotional Support Received
	study_received			Total Node Study Received
	s_exposure			Student Exposure to Teacher
	bsterm				Baseline Number of Terms in Education
	btsurvey_16_refprop		Refugee Population (%) in Desired Workplace
	btname_gone			Baseline Teacher left
	empathy_treatment		Dummy for empathy treatment classrooms
	backdesk				Seating at the back
	district				District
	btname				Baseline Teacher Name
	bexper				Baseline Experimenter
	maleref				Male Refugee Students
	csize				Classroom Size
	refshare				Refugee Student Share in the Classroom
	maleshare			Male Student Share in the Classroom
	sample0				Supplemented Sample
	sample1				Analysis Sample

	
[C] How to replicate the results using Stata: 
	(1) create a main folder. 
	(2) create the following sub folders: figures, tables. 
	(3) copy biat_ethnic.dta into the main folder. 
	(4) copy all the 11 (eleven) do-files into the main folder. 
	(5) start Stata and open "1_master.do" 
	(6) change the working directory to the location of your main folder. 
	(7) change the path1 and path2 globals to "./figures" and "./tables".
	(8) Install user written packages if they are not already installed.
	(9) run the "1_master.do". This do file will run the other 10 (ten) do-files. The tables and figures will be saved in the corresponding folders after estimations are done. 

[D] Output:
	appendix_tableA1.tex includes results reported in Table A1 of the online appendix.	appendix_tableA2.tex includes results reported in Table A2 of the online appendix.	appendix_tableA3.tex includes results reported in Table A3 of the online appendix.	appendix_tableA4a.tex includes results reported in Table A4 - panel 1 of the online appendix.	appendix_tableA4b.tex includes results reported in Table A4 - panel 2 of the online appendix.	appendix_tableA5a.tex includes results reported in Table A5 - panel 1 of the online appendix.	appendix_tableA5b.tex includes results reported in Table A5 - panel 2 of the online appendix.	appendix_tableA6.tex includes results reported in Table A6 of the online appendix.	table1.tex includes results reported in Table 1	table2.tex includes results reported in Table 2	table3.tex includes results reported in Table 3	table4.tex includes results reported in Table 4	table5.tex includes results reported in Table 5	table6.tex includes results reported in Table 6	table7.tex includes results reported in Table 7	appendix_figureA2.png includes figure reported in Figure A2 of the online appendix	appendix_figureA3.png includes figure reported in Figure A3 of the online appendix	appendix_figureA4a.png includes figure reported in Figure A4 of the online appendix	appendix_figureA4b.png includes figure reported in Figure A4 of the online appendix	appendix_figureA4c.png includes figure reported in Figure A4 of the online appendix	appendix_figureA4d.png includes figure reported in Figure A4 of the online appendix	appendix_figureA4e.png includes figure reported in Figure A4 of the online appendix	appendix_figureA4f.png includes figure reported in Figure A4 of the online appendix	appendix_figureA5.png includes figure reported in Figure A5 of the online appendix	figure1.png includes figure reported in Figure 1 	figure2.png includes figure reported in Figure 2
